#! /bin/bash
###
 # @Author: i@douxuefeng.cn
 # @Date: 2022-07-21 13:40:04
 # @LastEditTime: 2022-07-21 13:49:07
 # @LastEditors: i@douxuefeng.cn
 # @Description: 
 # @FilePath: \docker\docker.sh
### 

echo "+-----------------------------------------------------------------------+"
echo "|                   DNRMMP V1.0 By douxuefeng                            "
echo "+-----------------------------------------------------------------------+"
echo "|       A tool to auto-compile & install docker app on Linux             "
echo "+-----------------------------------------------------------------------+"
echo "|     For more information please visit https://gitee.com/douxuefeng     "
echo "+-----------------------------------------------------------------------+"


sudo apt update && sudo apt upgrade -y

echo "正在安装docker环境..."

sudo apt-get remove docker docker-engine docker.io

sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
   
sudo apt update

sudo apt install docker-ce -y

sudo usermod -aG docker ubuntu

newgrp docker

echo "正在安装docker-compose..."

# sudo curl -L https://github.com/docker/compose/releases/download/1.28.5/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# v2 版本更新
sudo mkdir -p /usr/local/lib/docker/cli-plugins
sudo cp docker-compose /usr/local/lib/docker/cli-plugins
sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose

#  设置docker镜像源
sudo cp daemon.json /etc/docker

echo "docker 安装成功！！"





